package com.gdones.bootserver.bus.platform.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gdones.bootserver.bus.platform.dto.Platform;
import com.gdones.bootserver.bus.platform.mapper.PlatformMapper;
import com.gdones.bootserver.bus.platform.service.IPlatformService;
import com.gdones.common.core.dto.MyResult;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author GaoJingBo
 * @since 2023-04-07
 */
@Service
public class PlatformServiceImpl extends ServiceImpl<PlatformMapper, Platform> implements IPlatformService {

    @Override
    public MyResult getData(String platformID) {
        MyResult result = new MyResult();

        PlatformMapper platformMapper = getBaseMapper();

        Platform platform = platformMapper.selectById(platformID);

        result.setData(platform);
        result.setMsg("查询成功");

        return result;
    }

    @Override
    public MyResult update(Platform platform) {
        MyResult result = new MyResult();

        PlatformMapper platformMapper = getBaseMapper();

        int i = platformMapper.updateById(platform);

        if(i>0){
            result.setMsg("平台信息修改成功！");
        }else{
            result.setCode("9999");
            result.setMsg("平台信息修改失败！");
        }

        return result;
    }
}
